home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / kernel / net / netInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-19  |  2.8 KB  |  105 lines

  1. /*
  2.  * netInt.h --
  3.  *
  4.  *    This defines the types and constants for the networking software.
  5.  *
  6.  * Copyright 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  *
  16.  * $Header: /cdrom/src/kernel/Cvsroot/kernel/net/netInt.h,v 9.3 92/06/03 22:47:57 voelker Exp $ SPRITE (Berkeley)
  17.  */
  18.  
  19. #ifndef _NETINT
  20. #define _NETINT
  21.  
  22. #include <sprite.h>
  23. #include <list.h>
  24. #include <bf.h>
  25. #include <net.h>
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28.  
  29. #include <netTypes.h>
  30.  
  31. /*
  32.  * The following is a NIL function pointer.
  33.  */
  34.  
  35. #define NILPROC    (void (*)()) NIL
  36.  
  37. /*
  38.  * The following macros are used to access bit fields in strings of bytes.
  39.  * The upper 24 bits of the index are the offset of the bit field, and
  40.  * the lower 8 bits are the size of the bit field.  See bf.h for info
  41.  * on the Bf macros.
  42.  */
  43.  
  44. #define NetBfByteSet(ptr, index, value)            \
  45.     Bf_ByteSet(ptr, (index) >> 8, (index) & 0xff, value)
  46.  
  47. #define NetBfByteTest(ptr, index, value)            \
  48.     Bf_ByteTest(ptr, (index) >> 8, (index) & 0xff, value)
  49.  
  50. #define NetBfByteGet(ptr, index)            \
  51.     Bf_ByteGet(ptr, (index) >> 8, (index) & 0xff)
  52.  
  53. #define NetBfShortSet(ptr, index, value)            \
  54.     Bf_HalfwordSet(ptr, (index) >> 8, (index) & 0xff, value)
  55.  
  56. #define NetBfShortTest(ptr, index, value)            \
  57.     Bf_HalfwordTest(ptr, (index) >> 8, (index) & 0xff, value)
  58.  
  59. #define NetBfShortGet(ptr, index)            \
  60.     Bf_HalfwordGet(ptr, (index) >> 8, (index) & 0xff)
  61.  
  62. #define NetBfWordSet(ptr, index, value)            \
  63.     Bf_WordSet(ptr, (index) >> 8, (index) & 0xff, value)
  64.  
  65. #define NetBfWordTest(ptr, index, value)            \
  66.     Bf_WordTest(ptr, (index) >> 8, (index) & 0xff, value)
  67.  
  68. #define NetBfWordGet(ptr, index)            \
  69.     Bf_WordGet(ptr, (index) >> 8, (index) & 0xff)
  70.  
  71. /*
  72.  * A transmission queue element.
  73.  */
  74.  
  75. typedef struct {
  76.     List_Links        links;
  77.     Net_EtherHdr    *etherHdrPtr;        /* Ethernet header with address
  78.                          * of receiver already set */
  79.     Net_ScatterGather    *scatterGatherPtr;    /* The scatter/gather array. */
  80.     int            scatterGatherLength;    /* Number of items in the 
  81.                            scatter/gather array. */
  82. } NetXmitElement;
  83.  
  84. extern    Net_EtherStats    net_EtherStats;
  85. extern    Net_Address     netEtherBroadcastAddress;
  86. extern Net_Interface    *netInterfaces[];
  87. extern int        netNumInterfaces;
  88. extern Net_Address    netZeroAddress;
  89. extern Boolean        netDebug;
  90. /*
  91.  * Procedures for the internet packet handler.
  92.  */
  93. extern void NetOutputWakeup _ARGS_((Sync_Semaphore *mutexPtr));
  94.  
  95. /*
  96.  * Forward declarations.
  97.  */
  98.  
  99. extern Net_Route *NetAllocRoute _ARGS_((void));
  100.  
  101.  
  102. extern void NetEtherInit _ARGS_((void));
  103.  
  104. #endif /* _NETINT */
  105.